<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
<fmt:setBundle basename="infomessages" var="info"/>
<%
	request.setAttribute("path", request.getContextPath());
%>
<c:forEach items="${groups}" var="item" varStatus="vs">
	<c:if test="${!vs.first && (vs.index mod 5 == 0) }">
		 <hr><br>
	</c:if>
	<c:set var="isChecked" value="false"/>
	<c:forEach items="${user.groups }" var="myGroup">
		<c:if test="${!isChecked && myGroup.id == item.key}">
			<c:set var="isChecked" value="true"/>
		</c:if>
	</c:forEach>
	<c:choose>
		<c:when test="${ isChecked}">
			<label class="checkbox inline">
				<input id="group${vs.count }"  name="groups" type="checkbox" value="${item.key }" checked />
				<c:out value="${item.value.name }"/>
			</label>
		</c:when>
		<c:otherwise>
			<label class="checkbox inline">
				<input id="group${vs.count }"  name="groups" type="checkbox" value="${item.key }"/>
				<c:out value="${item.value.name }"/>
			</label>
		</c:otherwise>
	</c:choose>
</c:forEach>

